<template>
  <div class="newslist">
    <van-card
      v-for="item in newslist"
      :key="item.id"
      :num="item.click"
      :price="item.add_time"
      :title="item.title"
      :thumb="item.img_url"
      @click="getNewsInfo(item.id)"
    >
      <template #num>
        {{ item.click }}
      </template>
      <template #price>
        {{ item.add_time }}
      </template>
    </van-card>
  </div>
</template>
<script>
export default {
  data() {
    return {
      newslist: []
    }
  },
  created() {
    this.getNewsList()
  },
  methods: {
    async getNewsList() {
      const res = await this.$http.getNewsList()
      this.newslist = res.data.message
    },
    getNewsInfo(id) {
      this.$router.push('/home/newsinfo/' + id)
    }
  }
}
</script>
<style lang="scss"  scoped>
.newslist {
  .van-card {
    .van-card__header {
      height: 65px;
      .van-card__thumb {
        height: 65px;
      }
      .van-card__content {
        height: 65px;
        box-sizing: border-box;
        min-height: 65px;
      }
    }
  }
}
</style>
